import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from '@/store/index'
import './plugins/element.js'
// 导入字体图标
import './assets/fonts/iconfont.css'

// 导入富文本编辑器
import  VueQuillEditor from 'vue-quill-editor'
// require styles 引入样式
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'

Vue.config.productionTip = false;

Vue.filter('dateFormat', function(originVal) {
  const dt = new Date(originVal * 1000);

  const y = dt.getFullYear();
  const m = (dt.getMonth() + 1 + '').padStart(2, '0');
  const d = (dt.getDate() + '').padStart(2, '0');

  const hh = (dt.getHours() + '').padStart(2, '0');
  const mm = (dt.getMinutes() + '').padStart(2, '0');
  const ss = (dt.getSeconds() + '').padStart(2, '0');

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
});
Vue.prototype.$getCookie = name => {
  let arr = document.cookie.split(';')
  let val = arr.find(v => v.includes( name + '='))
  if(!val) return ''
  return JSON.parse(val.split('=')[1]) 
}
Vue.prototype.$setCookie = (name, val) => {
  // console.log(val);
  // console.log(JSON.stringify(val));
  document.cookie = `${name}=${JSON.stringify(val)}`
}
Vue.prototype.$clearCookie = name => {
  document.cookie = `${name}=`
}

Vue.use(VueQuillEditor)

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
